<!DOCTYPE html>
<html lang="zh_CN">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script type="text/javascript">
    var str = '12ab23cde34f45';

    /*需求是把连续的整数找出来： [12, 23, 34, 45]*/
    function findNumberInString(str) {
        var rs = [];
        var tmp = '';

        for (var i = 0; i < str.length; i++) {
            if (str[i] >= '0' && str[i] <= '9') {
                tmp += str[i];
            } else {
                if (tmp) {
                    rs.push(tmp);
                    tmp = '';
                }
            }
        }

        if (tmp) {
            rs.push(tmp);
            tmp = '';
        }

        return rs;

    }


    console.log(findNumberInString(str));

</script>

</html>
